package com.lcredu.proxy;

/**
 * @author 黎长容
 * @date 2025-07-14 19:31
 */
public class Test {
    @org.junit.Test
    public void run() {
        Vehicle vehicle = new Car();
        //动态绑定
        vehicle.run();
    }


    @org.junit.Test
    public void ProxyTest() {
//        Vehicle vehicle = new Ship();
        Vehicle vehicle = new Car();

        //创建实现了接口对象传入代理对象中
        VehicleProxyProvider vehicleProxyProvider = new VehicleProxyProvider(vehicle);

        //获取代理对象,该对象可以代理执行方法
        //编译类型: Vehicle
        //运行类型: com.lcredu.proxy.Ship@610694f1
        Vehicle proxy = vehicleProxyProvider.getProxy();
        proxy.run();
        System.out.println("ok");
    }
}
